/**
 * MasicPort
 * <p/>
 * User: joakimd
 * Date: 2013-03-11
 * Time: 11:21
 */
package org.dru.masic {
public class MasicPort extends MasicMember {
    private var _stereo: Boolean;
    private var _left: Vector.<Number>;
    private var _right: Vector.<Number>;

    public function MasicPort(parent: MasicComponent, name: String, stereo: Boolean) {
        super(parent, name);
        _stereo = stereo;
        allocate();
    }

    public final function get stereo(): Boolean {
        return _stereo;
    }


    public final function get left(): Vector.<Number> {
        return _left;
    }

    protected final function setLeft(value: Vector.<Number>): void {
        _left = value;
    }

    public final function get right(): Vector.<Number> {
        return _right;
    }

    protected final function setRight(value: Vector.<Number>): void {
        _right = value;
    }

    protected final function allocate(): void {
        setLeft(new Vector.<Number>(MasicConstants.SAMPLE_BUFFER_SIZE, true));
        setRight(stereo ? new Vector.<Number>(MasicConstants.SAMPLE_BUFFER_SIZE, true) : null);
    }
}
}
